<?php

namespace IDock\Insurance\LIHI\Request;

use IDock\Insurance\LIHI\Request\AllLIHIRequest;
use IDock\Insurance\LIHI\Response\NonCarInquiryResponse;
use IDock\Insurance\LIHI\Response\NonCarProductListResponse;
use IDock\Visitor\NonCar\NonCarProductListVisitor;
use IDock\Visitor\NonCar\NonCarProductVisitor;
use IDock\Visitor\Premium\PremiumInquiryVisitor;

class NonCarInquiryRequest extends AllLIHIRequest
{

    protected $urlTip = '非车计划保存';

    public $route = 'cpservice/savePlan';

    protected $response = NonCarInquiryResponse::class;

    /*** @var  PremiumInquiryVisitor $visitor */
    protected $visitor;

    public $proposalNo = '';

    public function generate(): array
    {
        $this->flowId = $this->visitor->getExtInfoVisitor()->argc['flowId'] ?? '';
        /**
         * @var NonCarProductVisitor $row
         */
        $row = $this->visitor->getNonCarInquiryVisitor()->getNonCarList()[0] ?? [];
        return [
            'planLists' => [
                json_decode($row->argc['planJson'] ?? '')
            ],
        ];
    }
}
